package org.jiajie.coffeecodes.concurrent.thread;

import java.util.HashMap;
import java.util.Map;

/**
 * @author jie
 */
public class ThreadLocalTest {

    public static void main(String[] args) {
//        Map map = new HashMap();
//        map.get(11);
        Thread parentParent = new Thread(() -> {
            ThreadLocal<Integer> threadLocal = new ThreadLocal<>();
            threadLocal.set(1);
            InheritableThreadLocal<Integer> inheritableThreadLocal = new InheritableThreadLocal<>();
            inheritableThreadLocal.set(2);

            new Thread(() -> {
                System.out.println("threadLocal=" + threadLocal.get());
                System.out.println("inheritableThreadLocal=" + inheritableThreadLocal.get());
            }).start();
        }, "parent thread");
        parentParent.start();
    }
}
